package top.datacluster.basic.algorithm.leetcode.stack;

import java.util.Stack;

public class LeetCodeView61 {

    private Stack<Integer> in = new Stack<>();

    private Stack<Integer> out = new Stack<>();

    public LeetCodeView61() {

    }

    public void appendTail(int value) {
        in.push(value);
    }

    public int deleteHead() {
        if (in.isEmpty() && out.isEmpty()){
            return -1;
        }
        if (out.isEmpty()){
            while (!in.isEmpty()){
                out.push(in.pop());
            }
        }
        return out.pop();
    }
}
